using System;
using System.Collections.Generic;
using System.Text;
using NPack.Interfaces;
using NUnit.Framework;

namespace NPack.Blas.OperationsEngine.Tests
{
	[TestFixture]
	public class OperationsTests
	{
		[Test]
		public void MatrixToMatrixMultiply()
		{
			BlasMatrixOperations<DoubleComponent> engine = new BlasMatrixOperations<DoubleComponent>();
			Matrix<DoubleComponent> lhs = new Matrix<DoubleComponent>(MatrixFormat.RowMajor, 3, 3, new DoubleComponent(1));
			Matrix<DoubleComponent> rhs = new Matrix<DoubleComponent>(MatrixFormat.RowMajor, 3, 3, new DoubleComponent(1));
			
			Matrix<DoubleComponent> expected = new Matrix<DoubleComponent>(MatrixFormat.RowMajor, 3, 3, new DoubleComponent(1));
			IMatrix<DoubleComponent> result = engine.Multiply(lhs, rhs);

			Assert.AreEqual(expected[0, 0], result[0, 0]);
			Assert.AreEqual(expected[0, 1], result[0, 1]);
			Assert.AreEqual(expected[0, 2], result[0, 2]);
			Assert.AreEqual(expected[1, 0], result[1, 0]);
			Assert.AreEqual(expected[1, 1], result[1, 1]);
			Assert.AreEqual(expected[1, 2], result[1, 2]);
			Assert.AreEqual(expected[2, 0], result[2, 0]);
			Assert.AreEqual(expected[2, 1], result[2, 1]);
			Assert.AreEqual(expected[2, 2], result[2, 2]);
		}
	}
}
